/*
 * Copyright (C) Michael Opitz
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA
 */
#ifndef TITLE_H
#define TITLE_H

#include "dom.h"

#include <string>
#include <sstream>
#include <iostream>

#include <boost/shared_ptr.hpp>

using namespace std;

/**
 * \brief This namespace contains all model-classes.
 * \author Michael Opitz
 */
namespace model {
	/** 
	 * \brief This class represents a title
	 */
	class title {
	public:
		title():_duration(0) {}
		/** 
		 * \brief title creates a title from a dom-node
		 * 
		 * \param node is the node from which the title should be
		 * created
		 */
		title(const model::dom &node);
		/** 
		 * \brief title creates a title
		 * 
		 * \param tit is the name of the title
		 * \param dur is the duration of the title
		 */
		title(const string &tit, int dur): _title(tit), _duration(dur){}
		~title() {}

		/** 
		 * \brief parse parses a dom-node 
		 * 
		 * \param node is the node which should be parsed.
		 */
		void parse(const model::dom &node);

		/** 
		 * \brief set_title sets the name of the title
		 */
		void set_title(const string &t) {_title = t;}
		/** 
		 * \brief get_title returns the name of the title
		 */
		const string & get_title() const {return _title;}

		/** 
		 * \brief set_filename sets the filename of the title
		 */
		void set_filename(const string &f) {_filename = f;}
		/** 
		 * \brief get_filename returns the filename of the title
		 */
		const string & get_filename() const {return _filename;}

		/** 
		 * \brief set_duration sets the duration of the title
		 */
		void set_duration(int dur) {_duration = dur;}
		/** 
		 * \brief get_duration returns the duration of the title
		 */
		int get_duration() const {return _duration;}

		/** 
		 * \brief print prints the title. Only for debug purposes.
		 */
		void print() const;
		/** 
		 * \brief to_xml converts the title to a xml-structure
		 */
		string to_xml() const;
	private:
		string _title;
		string _filename;
		int _duration;
	};
}

#endif
